package org.dromara.exam.service;

import org.dromara.exam.domain.entity.ExamAnswer;
import org.dromara.exam.domain.vo.ExamAnswerVo;
import org.dromara.exam.domain.bo.ExamAnswerBo;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.exam.domain.vo.ExamProjectVo;

import java.util.Collection;
import java.util.List;

/**
 * 答题Service接口
 *
 * @author xiyin321
 * @date 2024-05-24
 */
public interface IExamAnswerService {

    /**
     * 查询答题
     */
    ExamAnswerVo queryById(Long id);

    /**
     * 查询答题列表
     */
    TableDataInfo<ExamAnswerVo> queryPage(ExamAnswerBo bo, PageQuery pageQuery);

    List<ExamAnswerVo> queryProjectListByUserId(ExamAnswerBo bo);

    TableDataInfo<ExamAnswerVo> queryRankPageList(ExamAnswerBo bo, PageQuery pageQuery);

    /**
     * 查询答题列表
     */
    List<ExamAnswerVo> queryList(ExamAnswerBo bo);

    /**
     * 新增答卷
     */
    ExamAnswerVo insertByBo(ExamProjectVo bo);

    /*批量添加*/
    void batchInsertOrUpdate(Collection<ExamAnswer> answers);

    /**
     * 暂存答卷
     * @param bo
     * @return
     */
    Boolean tempSaveByBo(ExamAnswerBo bo);

    /**
     * 保存答卷
     */
    ExamAnswerVo updateByBo(ExamAnswerBo bo);

    /**
     * 校验并批量删除答题信息
     */
    Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);

    /*根据项目ID进行删除*/
    Boolean deleteWithValidByPaperIds(Collection<Long> ids, Boolean isValid);

    /*获取项目的案卷数量*/
    Long getAnswerCountByPaperId(Long id);

    /*修改答卷分数*/
    ExamAnswerVo updateScoreById(ExamAnswerBo bo);


    /*根据项目ID列表查询答卷列表*/
    List<ExamAnswerVo> queryPapersList(ExamAnswerBo bo);

    /**
     * 根据项目ID列表查询答卷数量
     * @param ids 项目ID列表
     * @return
     */
    List<ExamProjectVo> queryAnswerCountByPaperIds(List<Long> ids);


    /**
     * 根据项目ID提交答卷
     * @param id
     */
    void submitAnswerByProjectId(Long id);
}
